package com.myapp.web.action.nag;

import java.util.List;
import com.myapp.model.entity.product.Product;
import com.myapp.service.product.ProductBo;
import com.opensymphony.xwork2.ActionSupport;

public class NavigationAction extends ActionSupport {

	private String prodId  = "";
	
	private ProductBo productBo;
	
	private Product product = null;
	
	public void setP(String prodId){
		this.prodId = prodId;
	}
	public String getP(){
		return prodId;
	}
	
	private static final long serialVersionUID = -3045428494238831322L;

	@SuppressWarnings("unused")
	@Override
	public String execute() throws Exception {
		List<Product> list = productBo.getLatestProducts();
		System.out.println("Navigation homepage");
		return SUCCESS;
	}
	
	public Product getProduct() {
		return this.product;
	}
	private void queryProduct(){
		int id = Integer.valueOf(prodId);
		product = productBo.getProduct(id);		
	}
	public String detail() throws Exception{
		queryProduct();
		return SUCCESS;
	}

	public void setProductBo(ProductBo productBo) {
		this.productBo = productBo;
	}

	public String show() throws Exception{
		queryProduct();
		return SUCCESS;
	}
}
